package com.livesource.client.web.liveSource;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.HasVerticalAlignment;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.livesource.client.LiveSourceGlobalVariables;

/**
 * 
 * @UserInterface
 */
public class LiveSourceHomePage extends VerticalPanel {

	public LiveSourceHomePage() {

		this(null, null);
	}

	public LiveSourceHomePage(VerticalPanel login, HTML sampleProject) {

		this.setSpacing(30);

		this.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

		this.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

		HorizontalPanel hp1 = new HorizontalPanel();

		hp1.setWidth("100%");

		hp1.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

		Image logo = new Image(GWT.getModuleName()
				+ "/liveSource/images/LiveSourceLogo.jpg");
		logo.setWidth("300px");

		hp1.add(logo);

		Label space = new Label(" ");
		space.setWidth("40px");
		hp1.add(space);

		HTML html = new HTML(
				"<center><br><b>"
						+ "<a href='http://golivesource.blogspot.com/2011/08/lean-code.html' target='_blank'>"
						+ "<font size=5 color=black>"
						+ "A Guide to the Lean Code</font></a></b> "
						+ "<br>Version "
						+ LiveSourceGlobalVariables.systemVersion + "</center>");
		hp1.add(html);

		this.add(hp1);

		HorizontalPanel hpMain = new HorizontalPanel();

		hpMain.setSize("100%", "100%");

		hpMain.setSpacing(30);

		if (login != null) {

			hpMain.add(new HowToUse(login, sampleProject));
		}

		hpMain.add(new BlogArchiveList());

		hpMain.add(new WhatIsLiveSource());

		this.add(hpMain);
	}

}
